package com.tancire.web.controller.member;

import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tancire.common.annotation.Log;
import com.tancire.common.core.controller.BaseController;
import com.tancire.common.core.domain.AjaxResult;
import com.tancire.common.enums.BusinessType;
import com.tancire.net.domain.NetUserPersonnel;
import com.tancire.net.service.INetUserPersonnelService;
import com.tancire.common.utils.poi.ExcelUtil;
import com.tancire.common.core.page.TableDataInfo;

/**
 * 会员认证Controller
 *
 * @author tancire
 * @date 2024-03-09
 */
@RestController
@RequestMapping("/net/netUserPersonnel")
public class NetUserPersonnelController extends BaseController {
    @Resource
    private INetUserPersonnelService netUserPersonnelService;

    /**
     * 查询会员认证列表
     */
    @PreAuthorize("@ss.hasPermi('net:netUserPersonnel:list')")
    @GetMapping("/list")
    public TableDataInfo list(NetUserPersonnel netUserPersonnel) {
        startPage();
        List<NetUserPersonnel> list = netUserPersonnelService.selectNetUserPersonnelList(netUserPersonnel);
        return getDataTable(list);
    }

    /**
     * 导出会员认证列表
     */
    @PreAuthorize("@ss.hasPermi('net:netUserPersonnel:export')")
    @Log(title = "会员认证", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, NetUserPersonnel netUserPersonnel) {
        List<NetUserPersonnel> list = netUserPersonnelService.selectNetUserPersonnelList(netUserPersonnel);
        ExcelUtil<NetUserPersonnel> util = new ExcelUtil<NetUserPersonnel>(NetUserPersonnel.class);
        util.exportExcel(response, list, "会员认证数据");
    }

    /**
     * 获取会员认证详细信息
     */
    @PreAuthorize("@ss.hasPermi('net:netUserPersonnel:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(netUserPersonnelService.selectNetUserPersonnelById(id));
    }

    /**
     * 新增会员认证
     */
    @PreAuthorize("@ss.hasPermi('net:netUserPersonnel:add')")
    @Log(title = "会员认证", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody NetUserPersonnel netUserPersonnel) {
        return toAjax(netUserPersonnelService.insertNetUserPersonnel(netUserPersonnel));
    }

    /**
     * 修改会员认证
     */
    @PreAuthorize("@ss.hasPermi('net:netUserPersonnel:edit')")
    @Log(title = "会员认证", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody NetUserPersonnel netUserPersonnel) {
        return toAjax(netUserPersonnelService.updateNetUserPersonnel(netUserPersonnel));
    }

    /**
     * 删除会员认证
     */
    @PreAuthorize("@ss.hasPermi('net:netUserPersonnel:remove')")
    @Log(title = "会员认证", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(netUserPersonnelService.deleteNetUserPersonnelByIds(ids));
    }
}
